package isstra.gestore;

public class Processo extends Thread {
	@SuppressWarnings("unused")
	private final int ID;
	private Gestore g;
	private final int MIN=1000, MAX=5000;
	private void delay(){
		try{
			Thread.sleep( (int)(Math.random()*(MAX-MIN)+MIN) );
		}catch( InterruptedException e ){}
	}
	public Processo( int ID, Gestore g ){
		super("P#"+ID);
		this.ID=ID; this.g=g;
	}
	public void run(){
		while( true ){
			g.request();
			delay();
			g.finish();
			delay();
		}
	}
}//Processo
